package com.mall.db.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.Date;

@Data
public class BaseEntity {
    @TableField(exist = false)
    private Integer pageCount=1;
    @TableField(exist = false)
    private Integer limit=10;
    @TableField(exist = false)
    private  Integer page=1;
    @TableField(exist = false)
    private  Integer count=0;
    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(exist = false)
    private Date updateTime;

    public Date getCreateTime() {
       if(StringUtils.isEmpty(createTime)){
           return new Date();
       }
       return createTime;
    }

    public Date getUpdateTime() {
        if(StringUtils.isEmpty(updateTime)){
            return new Date();
        }
        return updateTime;
    }
}
